package io_demo.Buffered;

import java.io.*;

public class BufferedOutputStreamDemo {
    public static void main(String[] args) {
        final String Path="FileDemo\\test2.txt";
        try (
                OutputStream out = new FileOutputStream(Path);
                BufferedOutputStream bufferOut= new BufferedOutputStream(out);
        ) {
           String SysLine=System.getProperty("line.separator");
           String  str=SysLine+"测试文档，用于测试BufferedOutputStrea";
           byte[] bytes=str.getBytes();//获取字符串Bytes
           bufferOut.write(bytes);//写入文件
           bufferOut.flush();//刷新
            System.out.println("输出成功！！");

        }catch(FileNotFoundException e){
            e.printStackTrace();
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
